{extend name='public/content'}

{block name="title"}
订单列表
{/block}

{block name="body"}
<div  ng-app="myApp" ng-controller="myCtrl"> 	
		<div class="layui-container">  
		  <div class="layui-row">
		    <div class="layui-col-xs2 layui-col-sm2 layui-col-md2 layui-btn" ng-click="shujulist(-1)">
		    	全部
		    </div>
		    <div class="layui-col-xs2 layui-col-sm2 layui-col-md2 layui-btn" ng-click="shujulist(0)">
		    	待付款
		    </div>
		    <div class="layui-col-xs2 layui-col-sm2 layui-col-md2 layui-btn" ng-click="shujulist(2)">
		    	待发货
		    </div>
		    <div class="layui-col-xs2 layui-col-sm2 layui-col-md2 layui-btn" ng-click="shujulist(3)">
		    	待收货
		    </div>
		    <div class="layui-col-xs2 layui-col-sm2 layui-col-md2 layui-btn" ng-click="shujulist(4)">
		    	待评价
		    </div>
		  </div>
		</div>	

		<div class="layui-container">  
		  <div class="layui-row" ng-repeat="x in ordlist">
		  	订单号：{{x.order_sn}}


		  	<div  style="width: 150px;height: 30px"
                  class=" layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" ng-click="huifu(x)" >
		    	订单详情	
		    </div>
		   
			<style type="text/css">
				.goodsimage{
                  width: 50px;
                  height: 40px
                }
				
			</style>

			    <div class="layui-col-xs6 layui-col-sm6 layui-col-md4" ng-repeat="y in x.orderdetail">
			    	<img ng-src="{{y.goods.logo}}" ng-class="ngcafwfwe()">
			    	<div>{{y.goods.name}}</div>
			    	<div ng-bind="y.goods.detail | trustHtml"></div>
			    	
			    </div>

		  
		    <div ng-show="x.order_status==0" style="width: 150px;height: 30px"
                 class=" layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" ng-click="fukun(x)" >
		    		立即付款
		    </div>
		     <div ng-show="x.order_status==1"  style="width: 150px;height: 30px"
                  class="layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4"  >
		    		已付款
		    </div>
		    <div ng-show="x.order_status==1"  style="width: 150px;height: 30px"
                 class="layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" ng-click="pingjia(x)" >
		    		退款
		    </div>
		   
		    <div ng-show="x.order_status==2"  style="width: 150px;height: 30px"
                 class="layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4">
		    		已收货
		    </div>
		     <div ng-show="x.order_status==2"  style="width: 150px;height: 30px"
                  class="layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" ng-click="pingjia(x)" >
		    		退款
		    </div>
		    <div ng-show="x.order_status==3"  style="width: 150px;height: 30px"
                 class="layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" ng-click="pingjia(x)" >
		    		退款
		    </div>
		    <div ng-show="x.order_status==3"  style="width: 150px;height: 30px"
                 class="layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" >
		    		
		    </div>
		    <div ng-show="x.order_status==4"   style="width: 150px;height: 30px"
                 class=" layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4">
		    		完成订单
		    </div>
		    <div ng-show="x.order_status==4"   style="width: 150px;height: 30px"
                 class="layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" ng-click="pingjia(x)" >
		    		退款
		    </div>


		    <div ng-show="x.order_status==4"   style="width: 150px;height: 30px"
                 class=" layui-btn layui-col-xs6 layui-col-sm6 layui-col-md4" ng-click="conmmont(x)" >
		    		评价订单
		    </div>
		  </div>
		</div>	
</div>



<div class=""></a>管理地址</div>

{/block}

{block name="script"}
 	<script type="text/javascript">
	require(['jquery','angular'], function () {
        angular.module('myApp', [])
            .service('$factory',function($http){
                var locg={
                    orderlist:function(status,call){
                        var url ="{:url('order/orderlistapi')}?status="+status;
                        $http.get(url,{}).then(function(res){call(res)})
                    }
                }
                return locg;
            })
            .controller('myCtrl', function($scope, $http,$factory) {
                $scope.ordlist = [];
                $factory.orderlist(-1,function(res){
                    $scope.ordlist=res.data.data;
                    console.log($scope.ordlist);
                })
                $scope.fukun=function(x){
                    window.location.href="{:url('index/order/orderpay')}?id="+x.id;
                }
                $scope.ngcafwfwe=function(){
                    return "goodsimage";
                }
                $scope.pingjia=function(x){
                    window.location.href="{:url('index/order/goodback')}?id="+x.id;
                }
                $scope.shujulist=function(x){
                    $factory.orderlist(x,function(res){
                        $scope.ordlist=res.data.data;
                    })
                }
                $scope.huifu=function(x){
                    window.location.href="{:url('index/order/orderdetail')}?id="+x.id;
                    console.dir(x);
                }
                $scope.conmmont =function(x){
                    window.location.href="{:url('index/order/ordercommon')}?id="+x.id;
                }
            })
            .filter('trustHtml', function ($sce) {
                return function (input) {

                    return $sce.trustAsHtml(input);
                }
            });
    })
</script>
{/block}

{block name="style"}
 <style type="text/css">
 	
 </style>
{/block}